package com.cyanite.playlv2api.parsers.json;

import com.cyanite.playlv2api.types.Response;

import org.json.JSONException;
import org.json.JSONObject;

public class ResponseParser extends AbstractParser<Response> {

    @Override
    public Response parse(JSONObject json) throws JSONException {
        Response response = new Response();
        if (json.has("response"))
            response.setValue(json.getString("response"));
        else if (json.has("tid"))
            response.setValue(json.getString("tid"));
        else if (json.has("avatar"))
            response.setValue(json.getString("avatar"));
        else if (json.has("url"))
            response.setValue(json.getString("url"));
        else if (json.has("content"))
            response.setValue(json.getString("content"));
        else if (json.has("id"))
            response.setValue(json.getString("id"));
        else if (json.has("pid"))
            response.setValue(json.getString("pid"));
        return response;
    }
}